/// \file
#ifndef _assert_h__
#define _assert_h__
#pragma warning(disable:4127)

#if defined(_DEBUG) || defined(_ARTIST) || defined(_QA)
#define _USE_ASSERTS
#endif

namespace gecko
{

#if defined(_USE_ASSERTS)

// Macro for custom assertions.
#define Assert(exp, msgString, ...)\
do\
{\
if ( !(exp) )\
{\
	gecko::_internal::_customAssert(__FILE__, __LINE__, msgString, ##__VA_ARGS__);\
}\
}\
while(0)

// Macro for printing debug messages.
#define DebugPrint(msgString, ...) gecko::_internal::_debugPrint(msgString, ##__VA_ARGS__)

// Macro for logging warnings.
#define Warning(msgString, ...) gecko::_internal::_warning(__FILE__, __LINE__, msgString, ##__VA_ARGS__)

// Macro for logging errors (exits program after debug break).
#define Error(msgString, ...) gecko::_internal::_criticalError(__FILE__, __LINE__, msgString, ##__VA_ARGS__)

// Override the default debug log file.
void SetLogFile(const char* filename);

// Log a message to the debug file and the TTY.
void Log(const char* msg);

// Clear the log file.
void ClearLog();

// Set the filtering for debug logging
void SetDebugLogFilter(const char * filterString);

// internal namespace (classes and functions in this namespace should not be used by client code).
namespace _internal
{
	void _debugPrint(const char* errorMsg, ...);
	void _warning(const char* file, int line, const char* warningMsg, ...);
	void _criticalError(const char* file, int line, const char* errorMsg, ...);
	void _customAssert(const char* file, int line, const char* errorMsg, ...);
} // namespace _internal

#else

// stubbed out stuff for builds without logging support...

#define DebugPrint(msgString, ...) void(0)
#define Assert(exp, msgString, ...) void(0)
#define Warning(msgString, ...) void(0)
#define Error(msgString, ...) void(0)

inline void SetLogFile(const char* /*filename*/){};
inline void Log(const char* /*msg*/, ...){};
inline void ClearLog(){};
inline void SetDebugLogFilter(const char * /*filterString*/){};

#endif // defined(_USE_ASSERTS)

} // namespace gecko

#endif // _assert_h__
